<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>



<?php     
    
    
    //variable de envio de informacion al menu Usuario ID
    $responseId         = $idUser;
    $idUser             = "idUser=".$idUser."&parent=".$parent;
    if (!$form->getObject()->isNew())
    $idUser            .= "&id=".$form->getObject()->getId();
    
    //Variable de la pagina
    $urlPage            = "parentesco";
    
    //Url de Actualizacion de Cliente Dashbioard
    $urlLoadUser        = "LoadUser('".url_for("dashboard/".$parent)."','".$idUser."','#User".$responseId."');";
    //Url de Actualizacion de Cliente Dashbioard / Cierre Ventana
    $urlLoadUserClose   = "javascritp:".$urlLoadUser."MenuClose();";
    //Url de Listar Atributos
    $urlListar          = "javascritp:LoadUser('".url_for($urlPage.'/index')."','".$idUser."','#slideDer-intConten');";
    //Url de Nuevo Atributo 
    $urlNew             = "javascritp:LoadUser('".url_for($urlPage.'/new')."','".$idUser."','#slideDer-intConten');";
    //Url de Delete Atributo 
    $urlDelete          = "javascritp:LoadUser('".url_for($urlPage.'/delete')."','".$idUser."','#slideDer-intConten');";
    
    
?>

<!--BOTON cerrado + condicion de actualización-->
<button type="button" class="slideDer-cerrar" onclick="<?php echo $urlLoadUserClose; ?>"></button>
<!--Division del formulario-->
<div class="jwj-callcenter-div"></div>


<!--Formulario con declaración de class y de ID Formulario-->
<form class="formGeneralModel" id="myForm<?php echo $urlPage; ?>" action="<?php echo url_for('parentesco/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <table class="formGeneralTable" border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr class="addEtiquetaTitulo">
            <td colspan="2"><p>Datos Basicos</p></td>
   </tr>
      <tr class="addEtiquetaFila">
            <td><?php echo $form['parentesco_tipo_id']->renderLabel() ?></td>
            <td><?php echo $form['parentesco_tipo_id']->renderError() ?>
            <?php echo $form['parentesco_tipo_id'] ?></td>
      </tr>
      
      <tr class="addEtiquetaFila"> 
            <td><?php echo $form['titulo_id']->renderLabel() ?></td>
            <td><?php echo $form['titulo_id']->renderError() ?>
                <?php echo $form['titulo_id'] ?></td>
            
      </tr>
      
      <tr class="addEtiquetaFila"> 
            <td><?php echo $form['nombre']->renderLabel() ?></td>
            <td <?php if($form['nombre']->renderError()) { echo "class=\"inputError\"";} ?>>
                    <?php echo $form['nombre']->renderError() ?>
                    <?php echo $form['nombre'] ?></td>
      </tr>
      
      <tr class="addEtiquetaFila"> 
            <td><?php echo $form['apellido']->renderLabel() ?></td>
            <td <?php if($form['apellido']->renderError()) { echo "class=\"inputError\"";} ?>>
                <?php echo $form['apellido']->renderError() ?>
                <?php echo $form['apellido'] ?></td>
            
      </tr>
      
      <tr class="addEtiquetaFila">
            <td><?php echo $form['telefono']->renderLabel() ?></td>
            <td <?php if($form['telefono']->renderError()) { echo "class=\"inputError\"";} ?>>
                <?php echo $form['telefono']->renderError() ?>
            <?php echo $form['telefono'] ?></td>
            
      </tr>
      
      <tr class="addEtiquetaFila">
            <td><?php echo $form['email']->renderLabel() ?></td>
            <td <?php if($form['email']->renderError()) { echo "class=\"inputError\"";} ?>>
                <?php echo $form['email']->renderError() ?>
                <?php echo $form['email'] ?></td>
        </tr>
    
      

  </table>



<!--Campo Oculto de evio de variable de ID del usuario-->
<input type="hidden" name="idUser" value='<?php echo $responseId ?>'/>
<input type="hidden" name="parent" value='<?php echo $parent ?>'/>

<!--Division del formulario-->
<div class="jwj-callcenter-div"></div>


<!--Lista de Acciones del Formulario-->
<div id="jwj-callcenter-action">
    
           <?php echo $form->renderHiddenFields(false) ?>
          <!--BOTON Salvado del formulario-->
          <input type="submit" value="Save" id="jwj-callcenter-form-save" class="jwj-callcenter-form-red"/>
          <?php if (!$form->getObject()->isNew()): ?>
          <!--BOTON Borrado del formulario-->
          <button type="button" id="jwj-callcenter-form-delete" class="jwj-callcenter-form-red" title="Listar" onclick="<?php echo $urlDelete; ?>" >Eliminar</button>
          <!--BOTON Nuevo-->
          <button type="button" id="AddBoton-New" title="Nuevo Registro" class="AddBotonTools" onclick="<?php echo $urlNew; ?>">Nuevo</button>
          <?php endif; ?>
          <!--BOTON Listar-->
          <button type="button" id="AddBoton-Listar" class="jwj-callcenter-form-red" title="Listar" onclick="<?php echo $urlListar; ?>" >Listar</button>
          <!--BOTON Cerrar-->
          <button type="button" id="AddBoton-Cerrar" title="Cerrar" class="AddBotonTools" onclick="<?php echo $urlLoadUserClose; ?>">Cerrar</button>
          
</div>


</form>

<script type="text/javascript">
  
// prepare tde form when tde DOM is ready
$(document).ready(function() {
    var options = {
        target:        '#slideDer-intConten',   // target element(s) to be updated witd server response
        beforeSubmit:  showRequest,  // pre-submit callback
        success:       showResponse,  // post-submit callback
        type: 'post'       // 'get' or 'post', override for form's 'method' attribute

    };

    // bind form using 'ajaxForm'
    $('#myForm<?php echo $urlPage; ?>').ajaxForm(options);
});

// pre-submit callback
function showRequest(formData, jqForm, options) {
    // formData is an array; here we use $.param to convert it to a string to display it
    // but tde form plugin does tdis for you automatically when it submits tde data
    var queryString = $.param(formData);
    // here we could return false to prevent tde form from being submitted;
    // returning anytding otder tdan false will allow tde form submit to continue
    return true;
}

// post-submit callback
function showResponse(responseText, statusText, xhr, $form)  {
    
     <?php echo $urlLoadUser; ?>
     
}
</script>